<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/**
 * Description of banner_model
 * 
 * @author Subha Sundar Das (subhasundar.das@gmail.com)
 */
class Requirement_model extends CI_Model {

    //put your code here

    function __construct() {
        parent::__construct();
        log_message('debug', 'Model Initialized');
    }

//-Get post Requirement (Multi Row)--//    
    function get_requirements($type='CAR',$status=1,$no=0,$offset=NULL,$mode='DESC'){
        if(isset($status)){
        $sql = "select * from post_requirement where status=$status and type='$type' order by id $mode limit $offset,$no";
        }
        else{
        $sql = "select * from post_requirement where type='$type' order by id $mode limit $offset,$no";
        }
        $query = $this->db->query($sql);
        $result = $query->result();
        return $result;
    }
    
 //-Get post Requirement (Single Row)--//    
    function get_requirement($type='CAR',$id,$status=51){
        $sql = "select * from post_requirement where status=$status and type='$type' and id=$id limit 1";
        return $this->db->query($sql)->row();;
    }
     function change_status($id, $status) {
        if($status==1){
          $sql="update post_requirement set status=51 where id=$id" ;
          }
          if($status==51){
          $sql="update post_requirement set status=1 where id=$id" ;
          } 
        $this->db->query($sql);
    }
}
?>
